using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace DriverSVH
{
    public struct SVHPositionSettings
    {
        //! Reference signal minimum value
        public float wmn;
        //! Reference signal maximum value
        public float wmx;
        //! Reference signal delta maximum threshold
        public float dwmx;
        //! Measurement scaling
        public float ky;
        //! Time base of controller
        public float dt;
        //! Integral windup minimum value
        public float imn;
        //! Integral windup maximum value
        public float imx;
        //! Proportional gain
        public float kp;
        //! Integral gain
        public float ki;
        //! Differential gain
        public float kd;
        public  SVHPositionSettings(float[] pos_settings)
        {
            int size = pos_settings.Length;
            wmn = (size > 0) ? pos_settings[0] : 0.0f;
            wmx = (size > 1) ? pos_settings[1] : 0.0f;
            dwmx = (size > 2) ? pos_settings[2] : 0.0f;
            ky = (size > 3) ? pos_settings[3] : 0.0f;
            dt = (size > 4) ? pos_settings[4] : 0.0f;
            imn = (size > 5) ? pos_settings[5] : 0.0f;
            imx = (size > 6) ? pos_settings[6] : 0.0f;
            kp = (size > 7) ? pos_settings[7] : 0.0f;
            ki = (size > 8) ? pos_settings[8] : 0.0f;
            kd = (size > 9) ? pos_settings[9] : 0.0f;
        }

        public SVHPositionSettings(float _wmn, float _wmx, float _dwmx, float _ky, float _dt, float _imn, float _imx, float _kp, float _ki, float _kd)
        {
            wmn = _wmn;
            wmx = _wmx;
            dwmx = _dwmx;
            ky = _ky;
            dt = _dt;
            imn = _imn;
            imx = _imx;
            kp = _kp;
            ki = _ki;
            kd = _kd;
        }
    }
}
